home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / _archvrs / amiga / pplib.lzh / PPLib / oberoninterface / PowerPacker.mod < prev    next >
Text File  |  1991-10-30  |  4KB  |  96 lines

  1. MODULE PowerPacker;
  2.  
  3. (*
  4. **      Filename: libraries/ppbase.h
  5. **      Release: 1.3
  6. **
  7. **      (C) Copyright 1991 Nico Franτois
  8. **          All Rights Reserved
  9. *)
  10.  
  11. IMPORT
  12.    s: SYSTEM, e: Exec, I: Intuition;
  13. CONST
  14.    PPName* = "powerpacker.library";
  15.    PPVersion* = 35;
  16.    (* decrunch colors for LoadData and DecrunchBuffer *)
  17.    DecrCol0*  = 0;
  18.    DecrCol1*  = 1;
  19.    DecrPoint* = 2;
  20.    DecrScrol* = 3;
  21.    DecrNone*  = 4;
  22.    (* error codes returned by LoadData *)
  23.    LoadOk*    =  0;
  24.    OpenErr*   = -1;
  25.    ReadErr*   = -2;
  26.    NoMemory*  = -3;
  27.    Crypted*   = -4;
  28.    PassErr*   = -5;
  29.    UnknownPP* = -6;
  30.    (* size of speedup buffer *)
  31.    SpeedupBuffLarge*  = 0;
  32.    SpeedupBuffMedium* = 1;
  33.    SpeedupBuffSmall*  = 2;
  34.    (* crunching efficiency *)
  35.    CrunFast*     = 0;
  36.    CrunMediocre* = 1;
  37.    CrunGood*     = 2;
  38.    CrunVeryGood* = 3;
  39.    CrunBest*     = 4;
  40.    (* possible return values from ppCrunchBuffer() *)
  41.    CrunchAborted  =  0;
  42.    BufferOverflow = -1;
  43. TYPE
  44.    PPBase* = STRUCT
  45.                 LibNode* : e.Library;
  46.                 flags* : SHORTSET;
  47.                 pad* : SHORTINT;
  48.                 segList* : LONGINT; (* BPTR *)
  49.              END; (* STRUCT *)
  50.    PPBasePtr* = POINTER TO PPBase;
  51.    PassFunc* = PROCEDURE (checksum: INTEGER; password: e.ADDRESS): BOOLEAN;
  52.    (** Must be of type "DeallocPars" and "SaveAllRegs" !! **)
  53.    PercFunc* = PROCEDURE (lensofar: LONGINT; crunlen: LONGINT;
  54.                           totlen: LONGINT; userdata: e.ADDRESS): BOOLEAN;
  55.    (** Must be of type "DeallocPars" and "SaveAllRegs" !! **)
  56. VAR
  57.    pp* : PPBasePtr;
  58.  
  59. PROCEDURE LoadData* {pp, -30} (filename{8}: ARRAY OF CHAR; col{0}: LONGINT;
  60.                                memtype{1}: LONGSET; VAR buffer{9}: e.ADDRESS;
  61.                                VAR len{10}: LONGINT; func{11}: PassFunc)
  62.                               : LONGINT;
  63. PROCEDURE DecrunchBuffer* {pp, -36} (endcrun{8}, decrbuf{9}, effptr{10}: e.ADDRESS;
  64.                                      col{0}: LONGINT);
  65. PROCEDURE CalcCheckSum* {pp, -42} (string{8}: ARRAY OF CHAR): INTEGER;
  66. PROCEDURE CalcPasskey* {pp, -48} (password{8}: ARRAY OF CHAR): LONGINT;
  67. PROCEDURE Decrypt* {pp, -54} (buffer{8}: e.ADDRESS; len{0}, key{1}: LONGINT);
  68. PROCEDURE GetPassword* {pp, -60} (screen{8}: I.ScreenPtr; buffer{9}: e.ADDRESS;
  69.                                   maxchars{0}: LONGINT; checksum{1}: INTEGER)
  70.                                  : BOOLEAN;
  71. PROCEDURE AllocCrunchInfo {pp, -96} (eff{0}: LONGINT; speedup{1}: LONGINT;
  72.                                      func{8}: PercFunc; userdata{9}: e.ADDRESS)
  73.                                     : e.ADDRESS;
  74. PROCEDURE FreeCrunchInfo {pp, -102} (crunchinfo{8}: e.ADDRESS);
  75. PROCEDURE CrunchBuffer {pp, -108} (crunchinfo{8}: e.ADDRESS; buffer{9}: e.ADDRESS;
  76.                                    len{0}: LONGINT) : LONGINT;
  77. PROCEDURE WriteDataHeader {pp, -114} (lock{0}: LONGINT; eff{1}: LONGINT;
  78.                                       crypt{2}: BOOLEAN; checksum{3}: LONGINT)
  79.                                      : BOOLEAN;
  80. PROCEDURE EnterPassword* {pp, -120} (screen{8}: I.ScreenPtr; buffer{9}: e.ADDRESS)
  81.                                     : BOOLEAN;
  82. PROCEDURE ErrorMessage* {pp, -132} (error{0}: LONGINT): ARRAY OF CHAR;
  83.  
  84. BEGIN
  85.    pp := s.VAL (PPBasePtr, e.OpenLibrary (PPName, PPVersion));
  86.    IF pp = NIL THEN
  87.       IF I.DisplayAlert (0, "\x00\x64\x14missing powerpacker.library V35\o\o",
  88.                          50) THEN END;
  89.       HALT (20)
  90.    END; (* IF *)
  91. CLOSE
  92.    IF pp # NIL THEN
  93.       e.CloseLibrary (s.VAL (e.LibraryPtr, pp))
  94.    END; (* IF *)
  95. END PowerPacker.
  96.